<!DOCTYPE html>
<html lang="en">
<head th:include="certificateWeb/headFoot :: headerCss">
</head>
<link rel="stylesheet" href="/css/certificateWeb/workNews/workNews.css">
<body id="body">
<div th:include="certificateWeb/headFoot :: header"></div>
<main id="main">
    <section class="sec_1">
        <div class="div_1">
            <ul>
                <li><a href="/certificate/testingCentreQuery">考核站点查询</a></li>
                <li><a href="/certificate/testingCentreQueryPx">培训基地查询</a></li>
                <li><a href="/certificate/certificateQuery">证书查询</a></li>
                <li class="this"><a href="/certificate/expertQuery">专家查询</a></li>
            </ul>
        </div>
        <div class="div_2">
            <label class="label_title">专家查询</label>
            <hr/>
            <div class="flex_a">
                <div>
                    <select name="type" id="type" class="form-control" style="width:140px">
                        <option value="">请选择</option>
                        <option value="0">考评员</option>
                        <option value="1">考务员</option>
                        <option value="2">考务技术员</option>
                        <option value="3">督导员</option>
                        <option value="4">讲师</option>
                    </select>
                </div>
                <div>
                    <input type="text" name="name" id="name" placeholder="请输入专家名称" class="form-control">
                </div>
                <div>
                    <button class="form-control  but_2" id="find" onclick="getList()">查询</button>
                </div>
            </div>
            <div class="div_5">
                <div id="news" style="margin-top: 20px"></div>
                <div style="clear: both"></div>
                <div id="page"></div>
            </div>
        </div>
        <div style="clear: both"></div>
    </section>

</main>
<div th:include="certificateWeb/headFoot :: footer"></div>
<script type="text/javascript" src="/js/xlPaging.js"></script>

<script>
    $(function () {
        getList()
    });

    function getList() {
        $.ajax({
            url: "/certificate/expertNameQuery",
            type: 'POST',
            data: {
                current: 1,
                number: 5,
                type: $("#type").val(),
                name: $("#name").val()
            },
            success: function (res) {
                if (res.data.pages == 0) {
                    $("#news").html('<div class="noData">暂无数据</div>');
                } else {
                    var list = res.data.records;
                    var news = '';
                    list.forEach(function (item, index) {
                        var a = '';
                        if (item.headPortrait == null || item.headPortrait == '') {
                            a = '<img style="width:147px;height:206px" src="/img/timg.jpg" >'
                        } else {
                            a = '<img style="width:147px;height:206px" src="' + item.headPortrait + '" >'
                        }
                        var c = '';
                        if (item.type == 0) {
                            c = "考评员"
                        }
                        if (item.type == 1) {
                            c = "考务员"
                        }
                        if (item.type == 2) {
                            c = "考务技术员"
                        }
                        if (item.type == 3) {
                            c = "督导员"
                        }
                        if (item.type == 4) {
                            c = "讲师"
                        }
                        news +=
                            '<div class="div_7 div_01 flex_a" >' +
                            '<div>' + a + '</div>' +
                            '<div style="margin-left: 20px"><div class="span_1 b18"><span class="title_1">专家名称：</span><p class="title_2">' + item.name + '</p></div>' +
                            '<div class="span_1 b18"><span class="title_1">所属单位：</span><p class="title_2">' + item.orgName + '</p></div>' +
                            '<div class="span_1 b18"><span class="title_1">领域名称：</span><p class="title_2">' + item.kpointsName + '</p></div>' +
                            '<div class="span_1 b18"><span class="title_1">专家类型：</span><p class="title_2">' + c + '</p></div>' +
                            '</div></div>'
                    });
                    $("#news").html(news);
                    page(1, res.data.pages);
                }


            }
        });
    }

    function page(num, tolPages) {
        $("#page").paging({
            nowPage: Number(num), // 当前页码
            pageNum: Number(tolPages), // 总页码
            buttonNum: 10, //要展示的页码数量
            canJump: 1,// 是否能跳转。0=不显示（默认），1=显示
            showOne: 0,//只有一页时，是否显示。0=不显示,1=显示（默认）
            callback: function (num) { //回调函数
                $.ajax({
                    url: "/certificate/expertNameQuery",
                    type: 'POST',
                    data: {
                        current: num,
                        number: 5,
                        type: $("#type").val(),
                        name: $("#name").val()
                    },
                    success: function (res) {
                        var list = res.data.records;
                        var news = '';
                        list.forEach(function (item, index) {
                            var a = '';
                            if (item.headPortrait == null || item.headPortrait == '') {
                                a = '<img style="width:147px;height:206px" src="/img/timg.jpg" >'
                            } else {
                                a = '<img style="width:147px;height:206px" src="' + item.headPortrait + '" >'
                            }
                            var c = '';
                            if (item.type == 0) {
                                c = "考评员"
                            }
                            if (item.type == 1) {
                                c = "考务员"
                            }
                            if (item.type == 2) {
                                c = "考务技术员"
                            }
                            if (item.type == 3) {
                                c = "督导员"
                            }
                            if (item.type == 4) {
                                c = "讲师"
                            }
                            news +=
                                '<div class="div_7 div_01 flex_a" >' +
                                '<div>'+a+'</div>' +
                                '<div style="margin-left: 20px"><div class="span_1 b18"><span class="title_1">专家名称：</span><p class="title_2">' + item.name + '</p></div>' +
                                '<div class="span_1 b18"><span class="title_1">所属单位：</span><p class="title_2">' + item.orgName + '</p></div>' +
                                '<div class="span_1 b18"><span class="title_1">领域名称：</span><p class="title_2">' + item.kpointsName + '</p></div>' +
                                '<div class="span_1 b18"><span class="title_1">专家类型：</span><p class="title_2">' + c + '</p></div>' +
                                '</div></div>'
                        });
                        $("#news").html(news)
                    }
                });
            }
        });
    }
</script>
</body>
</html>